package com.gph.saviorframework.mq.controller;

import com.gph.saviorframework.Constants;
import com.gph.saviorframework.mq.service.ClusterService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/" + Constants.FRAMEWORK_REQUEST_PATH + "/mq/cluster")
public class ClusterController {

    @Autowired
    private ClusterService clusterService;

    /** 日志输出 */
    final Logger logger = LoggerFactory.getLogger(TopicController.class);

    /** 领域对象名称 */
    private final String domain = "cluster";

    /** 视图前缀 */
    private final String viewPrefix = Constants.FRAMEWORK_REQUEST_PATH + "/" + "mq" + "/" + domain + "/" + domain + "_";

    @RequestMapping(value = "/index",method = RequestMethod.GET)
    public ModelAndView topicListPage(){
        ModelAndView mv = new ModelAndView();
        mv.setViewName(viewPrefix + "index");

        mv.addObject("clusterInfo",clusterService.getClusterInfoForMap());

        return mv;
    }

}
